home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / castools.zip / CAS.H < prev    next >
Text File  |  1990-01-05  |  19KB  |  369 lines

  1. /*  CAS.H    Communicating Applications Specification header file. =============
  2.  
  3.     Defines structures and constants used in the Intel/DCA Communicating
  4.     Applications Specification 1.0 Toolkit.
  5.  
  6.     This file must be included in any application source files that use
  7.     functions from the CAS Toolkit.
  8. ==============================================================================*/
  9.  
  10. typedef unsigned char BYTE;
  11. typedef unsigned short WORD;
  12. typedef unsigned long LONGWORD;
  13.  
  14. /*
  15.     CAS DATE structure:  Input to CAS function CASSetTaskDate,
  16.                          Output of CAS function CASGetTaskDate.
  17. */
  18. typedef struct {  /* THE FOLLOWING RANGES APPLY ONLY IF VALUES ARE NOT ALL 0 */
  19.     WORD    Year;                /* only 1980 to 2099 allowed */
  20.     BYTE    Month;               /* 1 - 12 */
  21.     BYTE    Day;                 /* must be valid day for given month/year */
  22. } CAS_DATE;
  23.  
  24. /*
  25.     CAS TIME structure:  Input to CAS function CASSetTaskTime,
  26.                          Output of CAS function CASGetTaskTime.
  27. */
  28. typedef struct {
  29.     BYTE    Hour;                       /* 0 - 23 */
  30.     BYTE    Minute;                     /* 0 - 59 */
  31.     BYTE    Second;                     /* 0 - 59 */
  32. } CAS_TIME;
  33.  
  34. #pragma pack(1)                         /* These CAS structures must be packed */
  35.  
  36. /*
  37.    CAS SIZE CONSTANTS
  38. */
  39. #define FNAMELENGTH     13
  40. #define DIRPATHLENGTH   68
  41. #define NAMELENGTH      32
  42. #define CSIDLENGTH      21
  43. #define PHONENUMLENGTH  47
  44. #define APPTAGLENGTH    64
  45. #define FULLFNAMELENGTH 80
  46. #define RESERVED2LENGTH 78
  47. #define FTRRESERVED     31
  48.  
  49. /*
  50.    EXTERNAL DATA BLOCK structure:  Output of CAS function CASGetExternalData.
  51. */
  52. typedef struct {
  53.     BYTE     CASMajorVer;                        /* CAS major version number */
  54.     BYTE     CASMinorVer;                        /* CAS minor version number */
  55.     char     DefaultDir[DIRPATHLENGTH];          /* Path to Comm software */
  56.     char     DefaultPhonebook[FNAMELENGTH];      /* Phone book file name */
  57.     char     DefaultLogo[FNAMELENGTH];           /* Logo file name */
  58.     char     DefaultSender[NAMELENGTH];          /* Specified by installer */
  59.     char     CSID[CSIDLENGTH];                   /* CCITT identification */
  60.     BYTE     RESERVED[107];                      /* Reserved for Intel use */
  61. } EDB;
  62.  
  63. /*
  64.    SINGLE FILE TRANSFER RECORD structure:  The fixed part of the input to CAS
  65.       function CASSubmitSingleFile.  The variable part is the cover page text.
  66.       Append a buffer containing the cover page text to this structure,
  67.       starting at the last field.
  68. */
  69. typedef struct {
  70.     BYTE    TransferType;                /* Type of transfer (file, fax etc) */
  71.     BYTE    TextSize;                    /* 0: 80colx66lin, 1: 132colx88lin */
  72.     WORD    EventTime;                   /* Time to send in DOS packed format */
  73.     WORD    EventDate;                   /* Date to send in DOS packed format */
  74.     char    DestinationName[NAMELENGTH]; /* To: field */
  75.     char    FileName[FULLFNAMELENGTH];   /* Path name of this file */
  76.     char    Phone[PHONENUMLENGTH];       /* Phone # to call */
  77.     char    ApplicationTag[APPTAGLENGTH];/* Application specific tag field */
  78.     char    RESERVED1;                   /* Reserved for Intel use */
  79.     BYTE    SendCover;                   /* 1:Send, 0:Don't send cover page */
  80.     BYTE    RESERVED2[23];               /* Reserved for Intel use */
  81.     char    CoverTextDummy;              /* Marks start of the Covertext */
  82. } SFTR;
  83.  
  84. /*
  85.    EVENT CONTROL FILE structure:  The FIXED part of the CAS specification for
  86.       a Control File.  (The variable parts are the cover page text and the
  87.       File Transfer Records.)
  88.  
  89.       The path and name of a disk file consisting of this structure plus the
  90.       cover page and the File Transfer Records is the input to the CAS
  91.       function CASSubmitTask.
  92.  
  93.       This structure is also the output of the high-level Toolkit function
  94.       CCPGetEventControlInfo.
  95. */
  96. typedef struct {
  97.     BYTE    EventType;                   /* Type of event (send, receive etc) */
  98.     BYTE    TransferType;                /* Type of transfer (file, fax etc) */
  99.     int     EventStatus;                 /* Status of event */
  100.     WORD    EventTime;                   /* Time to send or time received */
  101.     WORD    EventDate;                   /* Date to send or date received */
  102.     int     FileCount;                   /* Number of files to transfer */
  103.     WORD    FTROffset;                   /* Offset of 1st FTR in TCF on disk */
  104.     char    Phone[PHONENUMLENGTH];       /* [0-9] and [,!PTM*#] have meaning */
  105.     char    ApplicationTag[APPTAGLENGTH];/* Application specific tag field */
  106.     BYTE    RESERVED1;                    /* Reserved for Intel use */
  107.     BYTE    ConnectSeconds;               /* Time of connection: seconds */
  108.     BYTE    ConnectMinutes;               /* Time of connection: minutes */
  109.     BYTE    ConnectHours;                 /* Time of connection: hours */
  110.     LONGWORD TotalPages;                  /* Total # of pages in all files */
  111.     LONGWORD PagesSent;                   /* # of pages transmitted so far */
  112.     WORD    FilesSent;                    /* # of files transmitted so far */
  113.     BYTE    SendCover;                    /* 1:Send/0:don't send cover page */
  114.     WORD    ErrorCount;                   /* Total # of tranmission errors */
  115.     BYTE    RESERVED2[RESERVED2LENGTH];   /* Reserved for Intel use */
  116.     char    RemoteCSID[CSIDLENGTH];       /* Remote CCITT identification */
  117.     char    DestinationName[NAMELENGTH];  /* To: field */
  118.     char    SenderName[NAMELENGTH];       /* From: field */
  119.     char    LogoFilePath[FULLFNAMELENGTH];/* Path to logo file that is sent */
  120. } ECF;
  121.  
  122. /*
  123.    FILE TRANSFER RECORD structure:  One or more of these are a part of the
  124.       CAS Control File.  The path and name of this file is the input to the
  125.       CAS function CASSubmitTask.
  126.  
  127.       One of these structures representing the file currently being
  128.       transferred is part of the output structure of the CAS function
  129.       CASGetCurrentEventStatus.
  130.  
  131.       A linked list of one or more structures containing this structure is
  132.       the output of the high-level Toolkit function CASGetEventFileInfo.
  133. */
  134. typedef struct {
  135.     BYTE    FileType;                  /* Type of file (ASCII, PCX, DCX) */
  136.     BYTE    TextSize;                  /* 0: 80colx66lin, 1: 132colx88lin */
  137.     BYTE    FileStatus;                /* Status of file (opened, moved etc) */
  138.     LONGWORD BytesSent;                /* Bytes transmitted so far */
  139.     LONGWORD FileSize;                 /* Size of file in bytes */
  140.     WORD    PagesSent;                 /* Pages transmitted so far */
  141.     WORD    PageCount;                 /* # of pages in this file */
  142.     char    FileName[FULLFNAMELENGTH]; /* Path name of this file */
  143.     BYTE    AddPageIncrements;         /* Additional 1/8 inch increments */
  144.     char    PageLength;                /* Page length in inches */
  145.     char    RESERVED[FTRRESERVED];     /* Reserved for Intel use */
  146. } FTR;
  147.  
  148. /*
  149.    CURRENT EVENT CONTROL structure:  Output of the CAS function
  150.       CASGetCurrentEventStatus.
  151. */
  152. typedef struct {
  153.     ECF     ControlFile;              /* Control file of current event */
  154.     FTR     CurrentFileInTransit;     /* The FTR controlling the current file
  155.                                            transfer */
  156. } CECS;
  157.  
  158. /*
  159.    QUEUE STATUS structure:  Output of the CAS function CASGetQueueStatus.
  160. */
  161. typedef struct {
  162.     int     QChanges;                   /* # of changes since CCAM installed */
  163.     int     QControlFiles;              /* Current # of control files in queue*/
  164.     int     QReceivedFiles;             /* Current # of received files */
  165. } QSTAT;
  166.  
  167. /*
  168.    HARDWARE STATUS structure:  Output of the CAS function
  169.       CASGetHardwareStatus.
  170. */
  171. typedef struct {
  172.     BYTE    TransmissionStatus;       /* bit fields for transmission status */
  173.     int     RESERVED1;                /* reserved field                     */
  174.     BYTE    RetriesLeft;              /* number of retries left             */
  175.     BYTE    RESERVED2;                /* reserved field                     */
  176.     BYTE    PhoneLineStatus;          /* bit fields for phone line status   */
  177.     BYTE    BaudRateStatus;           /* bit fields for baud rate status    */
  178.     char    RESERVED3[3];             /* reserved field                     */
  179.     BYTE    HardwareStatus1;          /* additional status bit fields       */
  180.     BYTE    ComIOPorts;               /* bit fields for I/O and COM ports   */
  181.     BYTE    HardwareStatus2;          /* additional status bit fields       */
  182.     char    RESERVED4;                /* reserved field                     */
  183.     WORD    ErrorCount;               /* receiving/transmission errors      */
  184.     char    RESERVED5[14];            /* reserved field                     */
  185.     char    RemoteCSID[CSIDLENGTH];   /* CSID of the remote hardware        */
  186.     char    RESERVED6[77];            /* reserved field                     */
  187. } HWSTAT;
  188.  
  189. /* Data file header id values - used in graphic data files (PCX & DCX). */
  190. #define PCXID           0x0A            /* Id byte value for PCX files. */
  191. #define PCXENCODE       1               /* Encoding method for PCX files. */
  192. #define DCXID           987654321       /* Id word value for DCX files. */
  193.  
  194. /*
  195.    PCX FILE HEADER structure:  No current Toolkit functions use this
  196.       structure.  It would be useful for any functions that manipulate or
  197.       process PCX-format graphics files.
  198. */
  199. typedef struct {
  200.     BYTE    PCXid;                    /* Must be 0AH */
  201.     BYTE    Version;                  /* 2 suggested; 2 or more allowed */
  202.     BYTE    EncodingMethod;           /* Must be 1 */
  203.     BYTE    BitsPerPixel;             /* Must be 1 for Fax Mode transfer */
  204.     WORD    xMinPos;                  /* X position of upper left corner,
  205.                                          usually 0 */
  206.     WORD    yMinPos;                  /* Y position of upper left corner,
  207.                                          usually 0 */
  208.     WORD    xMaxPos;                  /* X position of bottom right corner,
  209.                                          maximum 1728.  xMaxPos - xMinPos + 1
  210.                                          must be a multiple of 8 */
  211.     WORD    yMaxPos;                  /* Y position of bottom right corner,
  212.                                          2200 recommended maximum. */
  213.     WORD    HResolution;              /* Display card horizontal resolution,
  214.                                          ignored in Fax mode.  640
  215.                                          recommended */
  216.     WORD    VResolution;              /* Display card vertical resolution,
  217.                                          ignored in Fax mode.  200
  218.                                          recommended */
  219.     BYTE    Palette[48];              /* Ignored in Fax mode; set to 0 */
  220.     BYTE    Reserved1;                /* Must be 0 */
  221.     BYTE    ColorPlanes;              /* Must be 1 for Fax mode */
  222.     WORD    HorizLineBytes;           /* Horizontal line width in bytes */
  223.     char    Reserved2[60];            /* Should be 0.  */
  224. } PCXFILE;
  225.  
  226. /*
  227.    DCX FILE structure:  No current Toolkit functions use this structure.  It
  228.       would be useful for any functions that manipulate or process DCX-format
  229.       graphics files.
  230. */
  231. typedef struct {
  232.     LONGWORD DCXid;                   /* Always 987,654,321 */
  233.     LONGWORD *PageOffsets;            /* Variable-length array of 4-byte
  234.                                           offsets, NULL-terminated */
  235. } DCXFILE;
  236.  
  237. #pragma pack()                        /* end of packed CAS structures */
  238.  
  239. /* CAS CONSTANTS */
  240.  
  241. /* CONTROL FILE STRUCTURE CONSTANTS */
  242.  
  243. /* EventType constants */
  244. #define SEND            0               /* Immediate send event */
  245. #define RECEIVE         1               /* Immediate receive event */
  246. #define POLLED_SEND     2               /* Polled send event */
  247. #define POLLED_RECEIVE  3               /* Polled receive event */
  248.  
  249. /* TransferType constants */
  250. #define FAX_200         0               /* 200x200 dpi fax mode */
  251. #define FAX_100         1               /* 100x100 dpi fax mode */
  252. #define FILE_TRANSFER   2               /* File transfer mode */
  253.  
  254. /* CASFindFirst and CASFindNext constants */
  255. #define NO_MORE_EVENTS 0x204            /* No (more) events in the queue */
  256. #define ANY_STATUS     -1               /* Search for event with any status */
  257.  
  258. /* EventStatus constants */
  259. #define COMPLETED       0               /* Event was successfully completed */
  260. #define WAITING         1               /* Waiting to be processed */
  261. #define DIALED          2               /* Number has been dialed */
  262. #define SENDING         3               /* Connection made -- sending */
  263. #define RECEIVING       4               /* Connection made -- receiving */
  264. #define ABORTED         5               /* Event was aborted */
  265. #define NEW_STATUS      6               /* Event has not been viewed before */
  266.  
  267. /* CoverPage constants */
  268. #define NO_COVER        0               /* Do NOT send cover page */
  269. #define COVER           1               /* Send cover page */
  270.  
  271. /* FILE TRANSFER RECORD CONSTANTS */
  272.  
  273. /* FileType constants */
  274. #define ASCII           0               /* ASCII file */
  275. #define PCX             1               /* PCX encoded graphics page */
  276. #define DCX             2               /* PCX encoded graphics document */
  277.  
  278. /* TextSize constants */
  279. #define NORMAL          0               /* 80 columns by 66 lines */
  280. #define SMALL           1               /* 132 columns by 88 lines */
  281.  
  282. /* FileStatus constants */
  283. #define UNTOUCHED       0               /* File has not been modified */
  284. #define OPENED          1               /* File has been opened */
  285. #define MOVED           2               /* File has been moved */
  286. #define DELETED         3               /* File was deleted */
  287. #define NOT_RECEIVED    4               /* File is not yet received */
  288.  
  289. /* CAS TOOLKIT LOW-LEVEL FUNCTION INTERNAL CONSTANTS */
  290.  
  291. /* CAS Function Numbers */
  292. #define INSTALLEDSTATE  0x00          /* CASGetInstalledState */
  293. #define SUBMITTASK      0x01          /* CASSubmitTask */
  294. #define ABORTCURRENT    0x02          /* CASAbortCurrentEvent */
  295. #define FINDFIRST       0x05          /* CASFindFirst */
  296. #define FINDNEXT        0x06          /* CASFindNext */
  297. #define OPENFILE        0x07          /* CASOpenTaskFile */
  298. #define DELETEFILE      0x08          /* CASDeleteFile */
  299. #define DELETEALL       0x09          /* CASDeleteAllFiles */
  300. #define GETEVENTDATE    0x0A          /* CASGetEventDate */
  301. #define SETEVENTDATE    0x0B          /* CASSetEventDate */
  302. #define GETEVENTTIME    0x0C          /* CASGetEventTime */
  303. #define SETEVENTTIME    0x0D          /* CASSetEventTime */
  304. #define GETEDB          0x0E          /* CASGetExternalData */
  305. #define AUTORCVSTATE    0x0F          /* CASARState */
  306. #define GETEVENTSTATUS  0x10          /* CASGetEventStatus */
  307. #define GETQUEUESTATUS  0x11          /* CASGetQueueStatus */
  308. #define GETHWSTATUS     0x12          /* CASGetHardwareStatus */
  309. #define RUNDIAGNOSTICS  0x13          /* CASRunDiagnostics */
  310. #define MOVEFILE        0x14          /* CASMoveReceivedFile */
  311. #define SUBMITSINGLE    0x15          /* CASSubmitSingleFile */
  312. #define UNINSTALL       0x16          /* CASUninstall */
  313.  
  314. /* Needed for calls to the Resident Manager. */
  315. #define CASCALL         0x2F          /* Resident Manager Interrupt vector */
  316. #define MULTIPLEX       0xCB          /* Default Multiplex number */
  317.  
  318. /* CONSTANTS FOR USING CAS TOOLKIT LOW-LEVEL FUNCTIONS */
  319.  
  320. /* Search direction specifiers for CASFindFirst & CASFindNext. */
  321. #define SEARCH_FORWARD  0             /* Search forward chronologically */
  322. #define SEARCH_BACKWARD 1             /* Search backward chronologically */
  323.  
  324. /* Used to specify the Queue to take action on. Used in various CAS calls. */
  325. #define TASK_QUEUE      0               /* Take action on Task Queue */
  326. #define RECEIVE_QUEUE   1               /* Take action on Receive Queue */
  327. #define LOG_QUEUE       2               /* Take action on Log Queue */
  328. #define UNKNOWN_QUEUE 255               /* Don't know which Queue to use */
  329.  
  330. /* Used to specify whether to START or STATUS diagnostics in CASRunDiagnostics. */
  331. #define START           1               /* Start diagnostics running */
  332. #define STATUS          0               /* Report status without waiting */
  333.  
  334. /* Used to specify whether to GET or SET in CASAutoReceiveState. */
  335. #define GET             0               /* Get Autoreceive state */
  336. #define SET             1               /* Set Autoreceive state */
  337.  
  338. /* Auto Receive State modes. */
  339. #define AR_OFF          0               /* Hardware is not set to Autoreceive */
  340. #define AR_ON           1               /* Hardware is set to Autoreceive */
  341.  
  342. /* Used to tell Resident Manager installation status in CASGetInstalledState. */
  343. #define NOTiOK          0               /* Not installed, OK to install */
  344. #define NOTiNO          1               /* Not installed, NOT OK to install */
  345. #define INSTALLED       0xFF            /* Resident Manager is installed */
  346.  
  347. /* CAS TOOLKIT LOW-LEVEL FUNCTION PROTOTYPES */
  348. extern int pascal CASGetInstalledState(void);
  349. extern int pascal CASSubmitTask(char *filespec);
  350. extern int pascal CASAbortCurrentEvent(void);
  351. extern int pascal CASFindFirst(int status, BYTE direction, BYTE queue);
  352. extern int pascal CASFindNext(BYTE queue);
  353. extern int pascal CASOpenFile(int handle, int file, BYTE queue);
  354. extern int pascal CASDeleteFile(int handle, int file, BYTE queue);
  355. extern int pascal CASDeleteAllFiles(BYTE queue);
  356. extern int pascal CASGetEventDate(int handle, BYTE queue, CAS_DATE *date);
  357. extern int pascal CASSetTaskDate(int handle, CAS_DATE *date);
  358. extern int pascal CASGetEventTime(int handle, BYTE queue, CAS_TIME *time);
  359. extern int pascal CASSetTaskTime(int handle, CAS_TIME *time);
  360. extern int pascal CASGetExternalData(EDB *buffer);
  361. extern int pascal CASAutoReceiveState(BYTE mode, BYTE *rings);
  362. extern int pascal CASGetCurrentEventStatus(CECS *buffer);
  363. extern int pascal CASGetQueueStatus(BYTE queue, QSTAT *buffer);
  364. extern int pascal CASGetHardwareStatus(HWSTAT *buffer);
  365. extern int pascal CASRunDiagnostics(BYTE mode);
  366. extern int pascal CASMoveReceivedFile(int handle, int file, char *filespec);
  367. extern int pascal CASSubmitSingleFile(SFTR *buffer);
  368. extern int pascal CASUnloadResidentManager(void);
  369.